package com.etc.dao;

import com.etc.entity.Cinema;
import com.etc.entity.Movie_cinema;
import com.etc.entity.Movie_cinema_relation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.util.List;

@Repository
public interface Movie_cinemaDao extends JpaRepository<Movie_cinema,Integer>,JpaSpecificationExecutor<Movie_cinema>,Serializable {

    /**
     * 根据影厅名模糊查询
     * @param query
     * @param pageable
     * @return
     */
    @Query("select mc from  Movie_cinema mc where mc.cname like %?1% order by mc.mstartime")
    Page<Movie_cinema> findByLike(String query, Pageable pageable);

    /**
     * 根据影厅名查所有数据 按时间排序
     * @param query
     * @return
     */
    @Query("select mc from  Movie_cinema mc where mc.cname=?1 order by mc.mstartime")
    List<Movie_cinema> findByCname1(String query);

    /**
     * 根据影厅名查所有数据
     * @param cname
     * @return
     */
    List <Movie_cinema> findByCname(String cname);
}